/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author HoangHai
 */
@Entity
@Table(name = "Subject")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Subject.findAll", query = "SELECT s FROM Subject s"),
    @NamedQuery(name = "Subject.findBySubID", query = "SELECT s FROM Subject s WHERE s.subID = :subID"),
    @NamedQuery(name = "Subject.findBySubName", query = "SELECT s FROM Subject s WHERE s.subName = :subName"),
    @NamedQuery(name = "Subject.findByStartDate", query = "SELECT s FROM Subject s WHERE s.startDate = :startDate"),
    @NamedQuery(name = "Subject.findByEndDate", query = "SELECT s FROM Subject s WHERE s.endDate = :endDate"),
    @NamedQuery(name = "Subject.findByScaleMark", query = "SELECT s FROM Subject s WHERE s.scaleMark = :scaleMark"),
    @NamedQuery(name = "Subject.findByPassMark", query = "SELECT s FROM Subject s WHERE s.passMark = :passMark"),
    @NamedQuery(name = "Subject.findByRePrice", query = "SELECT s FROM Subject s WHERE s.rePrice = :rePrice")})
public class Subject implements Serializable {
    @Column(name = "StartDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date startDate;
    @Column(name = "EndDate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date endDate;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "ScaleMark")
    private Double scaleMark;
    @Column(name = "PassMark")
    private Double passMark;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    @Basic(optional = false)
    //@NotNull
    @Column(name = "SubID")
    private Integer subID;
    @Size(max = 50)
    @Column(name = "SubName")
    private String subName;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "RePrice")
    private Double rePrice;
    @OneToMany(mappedBy = "subID")
    private List<Result> resultList;
    @OneToMany(mappedBy = "subID")
    private List<StuDetail> stuDetailList;
    @OneToMany(mappedBy = "subID")
    private List<ReEvaluation> reEvaluationList;

    public Subject() {
    }

    public Subject(Integer subID) {
        this.subID = subID;
    }

    public Integer getSubID() {
        return subID;
    }

    public void setSubID(Integer subID) {
        this.subID = subID;
    }

    public String getSubName() {
        return subName;
    }

    public void setSubName(String subName) {
        this.subName = subName;
    }

    public Double getRePrice() {
        return rePrice;
    }

    public void setRePrice(Double rePrice) {
        this.rePrice = rePrice;
    }

    @XmlTransient
    public List<Result> getResultList() {
        return resultList;
    }

    public void setResultList(List<Result> resultList) {
        this.resultList = resultList;
    }

    @XmlTransient
    public List<StuDetail> getStuDetailList() {
        return stuDetailList;
    }

    public void setStuDetailList(List<StuDetail> stuDetailList) {
        this.stuDetailList = stuDetailList;
    }

    @XmlTransient
    public List<ReEvaluation> getReEvaluationList() {
        return reEvaluationList;
    }

    public void setReEvaluationList(List<ReEvaluation> reEvaluationList) {
        this.reEvaluationList = reEvaluationList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (subID != null ? subID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Subject)) {
            return false;
        }
        Subject other = (Subject) object;
        if ((this.subID == null && other.subID != null) || (this.subID != null && !this.subID.equals(other.subID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Subject[ subID=" + subID + " ]";
    }

    public Date getStartDate() {
        return startDate;
    }

    public void setStartDate(Date startDate) {
        this.startDate = startDate;
    }

    public Date getEndDate() {
        return endDate;
    }

    public void setEndDate(Date endDate) {
        this.endDate = endDate;
    }

    public Double getScaleMark() {
        return scaleMark;
    }

    public void setScaleMark(Double scaleMark) {
        this.scaleMark = scaleMark;
    }

    public Double getPassMark() {
        return passMark;
    }

    public void setPassMark(Double passMark) {
        this.passMark = passMark;
    }
    
}
